package org.net.loader
{
	
	/**
	 * Resource Data
	 */
	public class ResourceData	{
		private var _url : String;
		
		//the key of loader to find the loader
		private var _key : String;
		
		
		/**
		 * ResourData constructor
		 * 
		 * @param url String
		 * @param key String  - default is null and the URL's file name will be the key
		 */
		public function ResourceData(url:String, key:String = null)
		{
			_url = url;
			if (key == null) {
				var separator : String = (url.indexOf("/") > -1) ? "/" : "\\";
				_key = _url.split(separator).pop().split(".").shift();
			} else {
				_key = key;
			}
		}
		
		/**
		 * 获得URL地址
		 * 
		 * @return URL地址
		 */
		public function get url() : String {
			return _url;
		}
		
		/**
		 * 获得键
		 * 
		 * @return 键
		 */
		public function get key() : String {
			return _key;
		}
	}
}